package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.OrdersProjectservice;
import com.zzyl.vo.NursingProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer/orders/project")
public class CustomerOrdersProjectController extends BaseController {

    @Autowired
    private OrdersProjectservice ordersProjectservice;

    /**
     * 分页查询护理项目列表
     * @param name
     * @param status
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/page")
    public ResponseResult<PageResponse<NursingProjectVo>> findByPage(
            @RequestParam(name = "name",required = false) String name,
            @RequestParam(name = "status",required = false) Integer status,
            @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,
            @RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize
    ){
        PageResponse<NursingProjectVo> voPage = ordersProjectservice.findByPage(name,status,pageNum,pageSize);
        return success(voPage);
    }

    /**
     * 根据编号查询护理项目信息
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseResult<NursingProjectVo> findById(@PathVariable(name = "id") Long id){
        NursingProjectVo nursingProjectVo = ordersProjectservice.findById(id);
        return success(nursingProjectVo);
    }
}
